package ylsb.controller;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import ylsb.dao.Hc2Mapper;
import ylsb.model.*;
import ylsb.service.*;
import ylsb.dao.*;
import ylsb.support.JsonResult;

import java.util.Date;

@RestController
@RequestMapping("import_xiangmu")
public class ImportXiangmuController {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Value("${userfilepath}")
    private String userfilepath;

    @Resource
    FujianService fujianService;

    // region mapper
    @Resource
    Hc2Mapper  hc2Mapper;
    @Resource
    Hc3Mapper  hc3Mapper;
    @Resource
    Hc45Mapper hc45Mapper;
    // endregion


    @Resource
    YltpyinjinService ddYltpyinjinService;
    @Resource
    ShebeiService ddShebeiService;
    @Resource
    DailiangchuangxinService ddDailiangchuangxinService;
    @Resource
    YltpbaofeiService ddYltpbaofeiService;
    @Resource
    YltphaocaiduibiaoService ddYltphaocaiduibiaoService;
    @Resource
    YltpzhuankeyinjinService ddYltpzhuankeyinjinService;
    @Resource
    HaocaiyinjinService ddHaocaiyinjinService;
    @Resource
    TiwaizhenduanService ddTiwaizhenduanService;
    @Resource
    YiyonghaocaiService ddYiyonghaocaiService;
    @Resource
    YltprenyuanfenpeiService ddYltprenyuanfenpeiService;
    @Resource
    YltpuserService ddYltpuserService;
    @Resource
    ShijiService ddShijiService;


    @RequestMapping("import")
    public JsonResult<?> importvalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("xuhao") String ppxuhao,
            @RequestParam("username") String ppusername,
            @RequestParam("buzhibie") String ppbuzhibie,
            @RequestParam("account") String ppaccount,
            @RequestParam("password") String pppassword

    ){
        try {
           if(ddYltpuserService.isexistByAccount(ppaccount)){
               List<YltpUser> mmuser=ddYltpuserService.findByAccount(ppaccount);
               String mmuserid=mmuser.get(0).getUserid();
               YltpUser mmmodifyuser =new YltpUser();
               mmmodifyuser.setUserid(mmuserid);
               mmmodifyuser.setUsername(ppusername);
               mmmodifyuser.setBuzhibie(ppbuzhibie);
               mmmodifyuser.setPassword(pppassword);
               mmmodifyuser.setUsertype("zj");
               if(ddYltpuserService.modify(mmmodifyuser)!=true){
                   return JsonResult.getSuccessResult("数据修改错误");
               }
               List<YltpRenyuanfenpei> mmyltpfenpei=ddYltprenyuanfenpeiService.findbyUserIDandXiangmuId(mmuserid,ppxianmguid);
               if(mmyltpfenpei.size()==0){
                   YltpRenyuanfenpei mmfenpei =new YltpRenyuanfenpei();
                   mmfenpei.setId(UUID.randomUUID().toString());
                   mmfenpei.setXiangmuid(ppxianmguid);
                   mmfenpei.setUserid(mmuserid);
                   mmfenpei.setIssubmit(0);
                   return  ddYltprenyuanfenpeiService.add(mmfenpei)==true? JsonResult.getSuccessResult("导入人员分配成功")
                           : JsonResult.getErrorResult("导入人员分配失败");
               }else{
                   return JsonResult.getSuccessResult("数据重复");
               }
           }else{
               YltpUser mmUser=new YltpUser();
               mmUser.setUserid(UUID.randomUUID().toString());
               mmUser.setUsername(ppusername);
               mmUser.setBuzhibie(ppbuzhibie);
               mmUser.setAccount(ppaccount);
               mmUser.setPassword(pppassword);
               mmUser.setUsertype("zj");
               YltpRenyuanfenpei mmfenpei =new YltpRenyuanfenpei();
               mmfenpei.setId(UUID.randomUUID().toString());
               mmfenpei.setXiangmuid(ppxianmguid);
               mmfenpei.setUserid(mmUser.getUserid());
               mmfenpei.setIssubmit(0);
               if(ddYltpuserService.add(mmUser)){

                   return  ddYltprenyuanfenpeiService.add(mmfenpei)==true? JsonResult.getSuccessResult("导入人员分配成功")
                           : JsonResult.getErrorResult("导入人员分配失败");

               }else{
                   return JsonResult.getErrorResult("导入用户失败");
               }
           }

        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> import: "+e.getMessage());
            return JsonResult.getErrorResult("导入失败！");
        }
    }

    @SuppressWarnings("resource")
    @RequestMapping("getvalue")
    public JsonResult<?> getvalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("fileurl") String mmFileUrl,
            HttpServletRequest request){
        try {

            //取出文档存放的根目录，并去除文件最后的斜杠
            if(userfilepath.endsWith("/")){
                userfilepath  = userfilepath.substring(0, userfilepath.length()-1);
            }

            mmFileUrl=mmFileUrl.substring(mmFileUrl.indexOf("importexecl"));
            String url = userfilepath+"/"+mmFileUrl;
            Workbook book = null;

            File f = new File(url);
            InputStream in = new FileInputStream(f);

            String prefix = url.substring(url.lastIndexOf(".")+1);
            if(prefix.equals("xls")) {
                book = new HSSFWorkbook(in);
            }else if(prefix.equals("xlsx")) {
                book = new XSSFWorkbook(in);
            }else {
                return JsonResult.getErrorResult("请上传xls或xlsx类型的文件！");
            }

            Sheet sheet = book.getSheetAt(0);
            if (sheet==null){
                return JsonResult.getErrorResult("请上传规范格式的EXCEL（确保上传数据在SHEET1中）！");
            }
            //int column= sheet.getRow(0).getPhysicalNumberOfCells();
            int rows = sheet.getPhysicalNumberOfRows();
            List<Map<String,Object>> mmReturnList = new ArrayList<Map<String,Object>>();

            for (int i = 1; i < rows ; i++) { //行
                Map<String,Object> mmMap = new HashMap<String,Object>();
                mmMap.put("序号", getCellFormatValue(sheet.getRow(i).getCell(0)));
                mmMap.put("姓名", getCellFormatValue(sheet.getRow(i).getCell(1)));
                mmMap.put("部职别", getCellFormatValue(sheet.getRow(i).getCell(2)));
                mmMap.put("账号", getCellFormatValue(sheet.getRow(i).getCell(3)));
                mmMap.put("密码", getCellFormatValue(sheet.getRow(i).getCell(4)));
                mmReturnList.add(mmMap);
            }

            in.close();
            return JsonResult.getSuccessResult(mmReturnList);


        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> getvalue: "+e.getMessage());
            return JsonResult.getErrorResult("获取数据失败！");
        }
    }
    //设备
    @SuppressWarnings("resource")
    @RequestMapping("get_shebeivalue")
    public JsonResult<?> get_shebeivalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("fileurl") String mmFileUrl,
            HttpServletRequest request){
        try {
            if(ddShebeiService.isexistByxiangmuId(ppxianmguid)){
                return JsonResult.getErrorResult("导入失败！该项目已存在数据，请删除后再导入。");
            }
            //取出文档存放的根目录，并去除文件最后的斜杠
            if(userfilepath.endsWith("/")){
                userfilepath  = userfilepath.substring(0, userfilepath.length()-1);
            }

            mmFileUrl=mmFileUrl.substring(mmFileUrl.indexOf("importexecl"));
            String url = userfilepath+"/"+mmFileUrl;
            Workbook book = null;

            File f = new File(url);
            InputStream in = new FileInputStream(f);

            String prefix = url.substring(url.lastIndexOf(".")+1);
            if(prefix.equals("xls")) {
                book = new HSSFWorkbook(in);
            }else if(prefix.equals("xlsx")) {
                book = new XSSFWorkbook(in);
            }else {
                return JsonResult.getErrorResult("请上传xls或xlsx类型的文件！");
            }

            Sheet sheet = book.getSheetAt(0);
            if (sheet==null){
                return JsonResult.getErrorResult("请上传规范格式的EXCEL（确保上传数据在SHEET1中）！");
            }
            //int column= sheet.getRow(0).getPhysicalNumberOfCells();
            int rows = sheet.getPhysicalNumberOfRows();
            List<Map<String,Object>> mmReturnList = new ArrayList<Map<String,Object>>();

            for (int i = 4; i < rows ; i++) { //第5行
                Map<String,Object> mmMap = new HashMap<String,Object>();
                mmMap.put("院区", getCellFormatValue(sheet.getRow(i).getCell(0)));
                mmMap.put("序号", getCellFormatValue(sheet.getRow(i).getCell(1)));
                mmMap.put("使用科室", getCellFormatValue(sheet.getRow(i).getCell(2)));
                mmMap.put("设备名称", getCellFormatValue(sheet.getRow(i).getCell(3)));
                mmMap.put("型号", getCellFormatValue(sheet.getRow(i).getCell(4)));
                mmMap.put("台件数", getCellFormatValue(sheet.getRow(i).getCell(5)));
                mmMap.put("生产厂家", getCellFormatValue(sheet.getRow(i).getCell(6)));
                mmMap.put("序列号", getCellFormatValue(sheet.getRow(i).getCell(7)));
                mmMap.put("启用时间", getCellFormatValue(sheet.getRow(i).getCell(8)));
                mmMap.put("设备投放公司", getCellFormatValue(sheet.getRow(i).getCell(9)));
                mmMap.put("现产权归属", getCellFormatValue(sheet.getRow(i).getCell(10)));
                mmMap.put("问题类别", getCellFormatValue(sheet.getRow(i).getCell(11)));
                mmMap.put("理由", getCellFormatValue(sheet.getRow(i).getCell(12)));
                mmReturnList.add(mmMap);
            }

            in.close();
            return JsonResult.getSuccessResult(mmReturnList);
        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> get_value: "+e.getMessage());
            return JsonResult.getErrorResult("获取项目中的数据失败！");
        }
    }
    //引进
    @SuppressWarnings("resource")
    @RequestMapping("get_yinjinvalue")
    public JsonResult<?> get_yinjinvalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("fileurl") String mmFileUrl,
            HttpServletRequest request){
        try {

            if(ddYltpyinjinService.isexistByxiangmuId(ppxianmguid)){
                return JsonResult.getErrorResult("导入失败！该项目已存在数据，请删除后再导入。");
            }

            //取出文档存放的根目录，并去除文件最后的斜杠
            if(userfilepath.endsWith("/")){
                userfilepath  = userfilepath.substring(0, userfilepath.length()-1);
            }

            mmFileUrl=mmFileUrl.substring(mmFileUrl.indexOf("importexecl"));
            String url = userfilepath+"/"+mmFileUrl;
            Workbook book = null;

            File f = new File(url);
            InputStream in = new FileInputStream(f);

            String prefix = url.substring(url.lastIndexOf(".")+1);
            if(prefix.equals("xls")) {
                book = new HSSFWorkbook(in);
            }else if(prefix.equals("xlsx")) {
                book = new XSSFWorkbook(in);
            }else {
                return JsonResult.getErrorResult("请上传xls或xlsx类型的文件！");
            }

            Sheet sheet = book.getSheetAt(0);
            if (sheet==null){
                return JsonResult.getErrorResult("请上传规范格式的EXCEL（确保上传数据在SHEET1中）！");
            }
            //int column= sheet.getRow(0).getPhysicalNumberOfCells();
            int rows = sheet.getPhysicalNumberOfRows();
            List<Map<String,Object>> mmReturnList = new ArrayList<Map<String,Object>>();

            for (int i = 2; i < rows ; i++) { //第3行
                Map<String,Object> mmMap = new HashMap<String,Object>();
                mmMap.put("序号", getCellFormatValue(sheet.getRow(i).getCell(0)));
                mmMap.put("科室名称", getCellFormatValue(sheet.getRow(i).getCell(1)));
                mmMap.put("设备名称", getCellFormatValue(sheet.getRow(i).getCell(2)));
                mmMap.put("通用名称", getCellFormatValue(sheet.getRow(i).getCell(3)));
                mmMap.put("预算单价", getCellFormatValue(sheet.getRow(i).getCell(4)));
                mmMap.put("数量", getCellFormatValue(sheet.getRow(i).getCell(5)));
                mmMap.put("预算金额", getCellFormatValue(sheet.getRow(i).getCell(6)));
                mmMap.put("设备类型", getCellFormatValue(sheet.getRow(i).getCell(7)));
                mmMap.put("配置理由", getCellFormatValue(sheet.getRow(i).getCell(8)));
                mmMap.put("备注", getCellFormatValue(sheet.getRow(i).getCell(9)));
                mmMap.put("红", getCellFormatValue(sheet.getRow(i).getCell(10)));
                mmReturnList.add(mmMap);
            }

            in.close();
            return JsonResult.getSuccessResult(mmReturnList);


        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> get_yinjinvalue: "+e.getMessage());
            return JsonResult.getErrorResult("获取项目中的数据失败！");
        }
    }
    @SuppressWarnings("resource")
    @RequestMapping("get_dailiangvalue")
    public JsonResult<?> get_dailiangvalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("fileurl") String mmFileUrl,
            HttpServletRequest request){
        try {

            if(ddDailiangchuangxinService.isexistByxiangmuId(ppxianmguid)){
                return JsonResult.getErrorResult("导入失败！该项目已存在数据，请删除后再导入。");
            }

            //取出文档存放的根目录，并去除文件最后的斜杠
            if(userfilepath.endsWith("/")){
                userfilepath  = userfilepath.substring(0, userfilepath.length()-1);
            }

            mmFileUrl=mmFileUrl.substring(mmFileUrl.indexOf("importexecl"));
            String url = userfilepath+"/"+mmFileUrl;
            Workbook book = null;

            File f = new File(url);
            InputStream in = new FileInputStream(f);

            String prefix = url.substring(url.lastIndexOf(".")+1);
            if(prefix.equals("xls")) {
                book = new HSSFWorkbook(in);
            }else if(prefix.equals("xlsx")) {
                book = new XSSFWorkbook(in);
            }else {
                return JsonResult.getErrorResult("请上传xls或xlsx类型的文件！");
            }
            Sheet sheet = book.getSheetAt(0);
            if (sheet==null){
                return JsonResult.getErrorResult("请上传规范格式的EXCEL（确保上传数据在SHEET1中）！");
            }
            int rows = sheet.getPhysicalNumberOfRows();
            List<Map<String,Object>> mmReturnList = new ArrayList<Map<String,Object>>();

            for (int i = 2; i < rows ; i++) { //行
                Map<String,Object> mmMap = new HashMap<String,Object>();
                mmMap.put("带量批次", getCellFormatValue(sheet.getRow(i).getCell(0)));
                mmMap.put("序号", getCellFormatValue(sheet.getRow(i).getCell(1)));
                mmMap.put("产品分类", getCellFormatValue(sheet.getRow(i).getCell(2)));
                mmMap.put("中标编码", getCellFormatValue(sheet.getRow(i).getCell(3)));
                mmMap.put("产品名称", getCellFormatValue(sheet.getRow(i).getCell(4)));
                mmMap.put("产品规格", getCellFormatValue(sheet.getRow(i).getCell(5)));
                mmMap.put("产品型号", getCellFormatValue(sheet.getRow(i).getCell(6)));
                mmMap.put("注册证号", getCellFormatValue(sheet.getRow(i).getCell(7)));
                mmMap.put("生产厂家", getCellFormatValue(sheet.getRow(i).getCell(8)));
                mmMap.put("单位", getCellFormatValue(sheet.getRow(i).getCell(9)));
                mmMap.put("单价", getCellFormatValue(sheet.getRow(i).getCell(10)));
                mmReturnList.add(mmMap);
            }
            in.close();
            return JsonResult.getSuccessResult(mmReturnList);
        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> get_dailiangvalue: "+e.getMessage());
            return JsonResult.getErrorResult("获取项目中的数据失败！");
        }
    }

    @SuppressWarnings("resource")
    @RequestMapping("get_baofei")
    public JsonResult<?> get_baofei(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("fileurl") String mmFileUrl,
            HttpServletRequest request){
        try {

            if(ddYltpbaofeiService.isexistByxiangmuId(ppxianmguid)){
                return JsonResult.getErrorResult("导入失败！改项目已存在数据，请删除后再导入。");
            }

            //取出文档存放的根目录，并去除文件最后的斜杠
            if(userfilepath.endsWith("/")){
                userfilepath  = userfilepath.substring(0, userfilepath.length()-1);
            }

            mmFileUrl=mmFileUrl.substring(mmFileUrl.indexOf("importexecl"));
            String url = userfilepath+"/"+mmFileUrl;
            Workbook book = null;

            File f = new File(url);
            InputStream in = new FileInputStream(f);

            String prefix = url.substring(url.lastIndexOf(".")+1);
            if(prefix.equals("xls")) {
                book = new HSSFWorkbook(in);
            }else if(prefix.equals("xlsx")) {
                book = new XSSFWorkbook(in);
            }else {
                return JsonResult.getErrorResult("请上传xls或xlsx类型的文件！");
            }

            Sheet sheet = book.getSheetAt(0);
            if (sheet==null){
                return JsonResult.getErrorResult("请上传规范格式的EXCEL（确保上传数据在SHEET1中）！");
            }
            //int column= sheet.getRow(0).getPhysicalNumberOfCells();
            int rows = sheet.getPhysicalNumberOfRows();
            List<Map<String,Object>> mmReturnList = new ArrayList<Map<String,Object>>();
            for (int i = 2; i < rows ; i++) { //行
                Map<String,Object> mmMap = new HashMap<String,Object>();
                mmMap.put("序号", getCellFormatValue(sheet.getRow(i).getCell(0)));
                mmMap.put("使用科室", getCellFormatValue(sheet.getRow(i).getCell(1)));
                mmMap.put("设备名称", getCellFormatValue(sheet.getRow(i).getCell(2)));
                mmMap.put("规格型号", getCellFormatValue(sheet.getRow(i).getCell(3)));
                mmMap.put("设备价值", getCellFormatValue(sheet.getRow(i).getCell(4)));
                mmMap.put("数量", getCellFormatValue(sheet.getRow(i).getCell(5)));
                mmMap.put("生产厂商", getCellFormatValue(sheet.getRow(i).getCell(6)));
                mmMap.put("采购时间", getCellFormatValue(sheet.getRow(i).getCell(7)));
                mmMap.put("来源", getCellFormatValue(sheet.getRow(i).getCell(8)));
                mmReturnList.add(mmMap);
            }

            in.close();
            return JsonResult.getSuccessResult(mmReturnList);

        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> get_baofei: "+e.getMessage());
            return JsonResult.getErrorResult("获取项目中的数据失败！");
        }
    }
    @SuppressWarnings("resource")
    @RequestMapping("get_haocaiduibiao")
    public JsonResult<?> get_haocaiduibiao(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("fileurl") String mmFileUrl,
            HttpServletRequest request){
        try {

            if(ddYltphaocaiduibiaoService.isexistByxiangmuId(ppxianmguid)){
                return JsonResult.getErrorResult("导入失败！该项目已存在数据，请删除后再导入。");
            }

            //取出文档存放的根目录，并去除文件最后的斜杠
            if(userfilepath.endsWith("/")){
                userfilepath  = userfilepath.substring(0, userfilepath.length()-1);
            }

            mmFileUrl=mmFileUrl.substring(mmFileUrl.indexOf("importexecl"));
            String url = userfilepath+"/"+mmFileUrl;
            Workbook book = null;

            File f = new File(url);
            InputStream in = new FileInputStream(f);

            String prefix = url.substring(url.lastIndexOf(".")+1);
            if(prefix.equals("xls")) {
                book = new HSSFWorkbook(in);
            }else if(prefix.equals("xlsx")) {
                book = new XSSFWorkbook(in);
            }else {
                return JsonResult.getErrorResult("请上传xls或xlsx类型的文件！");
            }

            Sheet sheet = book.getSheetAt(0);
            if (sheet==null){
                return JsonResult.getErrorResult("请上传规范格式的EXCEL（确保上传数据在SHEET1中）！");
            }
            //int column= sheet.getRow(0).getPhysicalNumberOfCells();
            int rows = sheet.getPhysicalNumberOfRows();
            List<Map<String,Object>> mmReturnList = new ArrayList<Map<String,Object>>();
            for (int i = 2; i < rows ; i++) { //行
                Map<String,Object> mmMap = new HashMap<String,Object>();
                mmMap.put("序号", getCellFormatValue(sheet.getRow(i).getCell(0)));
                mmMap.put("名称", getCellFormatValue(sheet.getRow(i).getCell(1)));
                mmMap.put("规格", getCellFormatValue(sheet.getRow(i).getCell(2)));
                mmMap.put("注册证名称", getCellFormatValue(sheet.getRow(i).getCell(3)));
                mmMap.put("注册证规格", getCellFormatValue(sheet.getRow(i).getCell(4)));
                mmMap.put("注册证号", getCellFormatValue(sheet.getRow(i).getCell(5)));
                mmMap.put("生产厂家", getCellFormatValue(sheet.getRow(i).getCell(6)));
                mmMap.put("计价单位", getCellFormatValue(sheet.getRow(i).getCell(7)));
                mmMap.put("采购价", getCellFormatValue(sheet.getRow(i).getCell(8)));
                mmMap.put("使用科室", getCellFormatValue(sheet.getRow(i).getCell(9)));
                mmMap.put("平台编码", getCellFormatValue(sheet.getRow(i).getCell(10)));
                mmReturnList.add(mmMap);
            }

            in.close();
            return JsonResult.getSuccessResult(mmReturnList);

        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> get_haocaiduibiao: "+e.getMessage());
            return JsonResult.getErrorResult("获取项目中的数据失败！");
        }
    }
    @SuppressWarnings("resource")
    @RequestMapping("get_zhuankeyinjin")
    public JsonResult<?> get_zhuankeyinjin(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("fileurl") String mmFileUrl,
            HttpServletRequest request){
        try {

            if(ddYltpzhuankeyinjinService.isexistByxiangmuId(ppxianmguid)){
                return JsonResult.getErrorResult("导入失败！该项目已存在数据，请删除后再导入。");
            }

            //取出文档存放的根目录，并去除文件最后的斜杠
            if(userfilepath.endsWith("/")){
                userfilepath  = userfilepath.substring(0, userfilepath.length()-1);
            }

            mmFileUrl=mmFileUrl.substring(mmFileUrl.indexOf("importexecl"));
            String url = userfilepath+"/"+mmFileUrl;
            Workbook book = null;

            File f = new File(url);
            InputStream in = new FileInputStream(f);

            String prefix = url.substring(url.lastIndexOf(".")+1);
            if(prefix.equals("xls")) {
                book = new HSSFWorkbook(in);
            }else if(prefix.equals("xlsx")) {
                book = new XSSFWorkbook(in);
            }else {
                return JsonResult.getErrorResult("请上传xls或xlsx类型的文件！");
            }

            Sheet sheet = book.getSheetAt(0);
            if (sheet==null){
                return JsonResult.getErrorResult("请上传规范格式的EXCEL（确保上传数据在SHEET1中）！");
            }
            //int column= sheet.getRow(0).getPhysicalNumberOfCells();
            int rows = sheet.getPhysicalNumberOfRows();
            List<Map<String,Object>> mmReturnList = new ArrayList<Map<String,Object>>();
            for (int i = 3; i < rows ; i++) { //行
                Map<String,Object> mmMap = new HashMap<String,Object>();
                mmMap.put("序号", getCellFormatValue(sheet.getRow(i).getCell(0)));
                mmMap.put("需求科室", getCellFormatValue(sheet.getRow(i).getCell(1)));
                mmMap.put("耗材编号", getCellFormatValue(sheet.getRow(i).getCell(2)));
                mmMap.put("现用名称", getCellFormatValue(sheet.getRow(i).getCell(3)));
                mmMap.put("现用规格", getCellFormatValue(sheet.getRow(i).getCell(4)));
                mmMap.put("现用生产厂家", getCellFormatValue(sheet.getRow(i).getCell(5)));
                mmMap.put("现用单价", getCellFormatValue(sheet.getRow(i).getCell(6)));
                mmMap.put("拟更名称", getCellFormatValue(sheet.getRow(i).getCell(7)));
                mmMap.put("拟更规格", getCellFormatValue(sheet.getRow(i).getCell(8)));
                mmMap.put("拟更生产厂家", getCellFormatValue(sheet.getRow(i).getCell(9)));
                mmMap.put("拟更单价", getCellFormatValue(sheet.getRow(i).getCell(10)));
                mmMap.put("中标信息", getCellFormatValue(sheet.getRow(i).getCell(11)));
                mmReturnList.add(mmMap);
            }

            in.close();
            return JsonResult.getSuccessResult(mmReturnList);

        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> get_zhuankeyinjin: "+e.getMessage());
            return JsonResult.getErrorResult("获取项目中的数据失败！");
        }
    }

    @SuppressWarnings("resource")
    @RequestMapping("get_haocaiyinjin")
    public JsonResult<?> get_haocaiyinjin(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("fileurl") String mmFileUrl,
            HttpServletRequest request){
        try {

            if(ddHaocaiyinjinService.isexistByxiangmuId(ppxianmguid)){
                return JsonResult.getErrorResult("导入失败！该项目已存在数据，请删除后再导入。");
            }

            //取出文档存放的根目录，并去除文件最后的斜杠
            if(userfilepath.endsWith("/")){
                userfilepath  = userfilepath.substring(0, userfilepath.length()-1);
            }

            mmFileUrl=mmFileUrl.substring(mmFileUrl.indexOf("importexecl"));
            String url = userfilepath+"/"+mmFileUrl;
            Workbook book = null;

            File f = new File(url);
            InputStream in = new FileInputStream(f);

            String prefix = url.substring(url.lastIndexOf(".")+1);
            if(prefix.equals("xls")) {
                book = new HSSFWorkbook(in);
            }else if(prefix.equals("xlsx")) {
                book = new XSSFWorkbook(in);
            }else {
                return JsonResult.getErrorResult("请上传xls或xlsx类型的文件！");
            }

            Sheet sheet = book.getSheetAt(0);
            if (sheet==null){
                return JsonResult.getErrorResult("请上传规范格式的EXCEL（确保上传数据在SHEET1中）！");
            }
            //int column= sheet.getRow(0).getPhysicalNumberOfCells();
            int rows = sheet.getPhysicalNumberOfRows();
            List<Map<String,Object>> mmReturnList = new ArrayList<Map<String,Object>>();

            for (int i = 2; i < rows ; i++) { //行
                Map<String,Object> mmMap = new HashMap<String,Object>();
                mmMap.put("序号", getCellFormatValue(sheet.getRow(i).getCell(0)));
                if(isMergedRegion(sheet,i,1)==true){
                    mmMap.put("品种", getMergeRegionValue(sheet,i,1));
                }else{
                    mmMap.put("品种", getCellFormatValue(sheet.getRow(i).getCell(1)));
                }
                if(isMergedRegion(sheet,i,2)==true){
                    mmMap.put("品牌", getMergeRegionValue(sheet,i,2));
                }else{
                    mmMap.put("品牌", getCellFormatValue(sheet.getRow(i).getCell(2)));
                }
                mmMap.put("型号拆分", getCellFormatValue(sheet.getRow(i).getCell(3)));
                mmMap.put("平台编码", getCellFormatValue(sheet.getRow(i).getCell(4)));
                mmMap.put("注册证名称", getCellFormatValue(sheet.getRow(i).getCell(5)));
                mmMap.put("规格", getCellFormatValue(sheet.getRow(i).getCell(6)));
                mmMap.put("型号", getCellFormatValue(sheet.getRow(i).getCell(7)));
                mmMap.put("注册证号", getCellFormatValue(sheet.getRow(i).getCell(8)));
                mmMap.put("生产商", getCellFormatValue(sheet.getRow(i).getCell(9)));
                mmMap.put("计价单位", getCellFormatValue(sheet.getRow(i).getCell(10)));
                mmMap.put("平台情况", getCellFormatValue(sheet.getRow(i).getCell(11)));
                mmMap.put("平台单价", getCellFormatValue(sheet.getRow(i).getCell(12)));
                mmMap.put("南京市医保码", getCellFormatValue(sheet.getRow(i).getCell(13)));
                mmMap.put("简要功能用途", getCellFormatValue(sheet.getRow(i).getCell(14)));
                mmReturnList.add(mmMap);
            }

            in.close();
            return JsonResult.getSuccessResult(mmReturnList);


        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> get_haocaiyinjinvalue: "+e.getMessage());
            return JsonResult.getErrorResult("获取项目中的数据失败！");
        }
    }

    @SuppressWarnings("resource")
    @RequestMapping("get_shiji")
    public JsonResult<?> get_shiji(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("fileurl") String mmFileUrl,
            HttpServletRequest request){
        try {

            if(ddShijiService.isexistByxiangmuId(ppxianmguid)){
                return JsonResult.getErrorResult("导入失败！该项目已存在数据，请删除后再导入。");
            }

            //取出文档存放的根目录，并去除文件最后的斜杠
            if(userfilepath.endsWith("/")){
                userfilepath  = userfilepath.substring(0, userfilepath.length()-1);
            }

            mmFileUrl=mmFileUrl.substring(mmFileUrl.indexOf("importexecl"));
            String url = userfilepath+"/"+mmFileUrl;
            Workbook book = null;

            File f = new File(url);
            InputStream in = new FileInputStream(f);

            String prefix = url.substring(url.lastIndexOf(".")+1);
            if(prefix.equals("xls")) {
                book = new HSSFWorkbook(in);
            }else if(prefix.equals("xlsx")) {
                book = new XSSFWorkbook(in);
            }else {
                return JsonResult.getErrorResult("请上传xls或xlsx类型的文件！");
            }

            Sheet sheet = book.getSheetAt(0);
            if (sheet==null){
                return JsonResult.getErrorResult("请上传规范格式的EXCEL（确保上传数据在SHEET1中）！");
            }
            //int column= sheet.getRow(0).getPhysicalNumberOfCells();
            int rows = sheet.getPhysicalNumberOfRows();
            List<Map<String,Object>> mmReturnList = new ArrayList<Map<String,Object>>();

            for (int i = 4; i < rows ; i++) { //第五行
                Map<String,Object> mmMap = new HashMap<String,Object>();
                mmMap.put("类别", getCellFormatValue(sheet.getRow(i).getCell(0)));
                mmMap.put("序号", getCellFormatValue(sheet.getRow(i).getCell(1)));
                if(isMergedRegion(sheet,i,2)==true){
                    mmMap.put("品种序号", getMergeRegionValue(sheet,i,2));
                }else{
                    mmMap.put("品种序号", getCellFormatValue(sheet.getRow(i).getCell(2)));
                }
                if(isMergedRegion(sheet,i,3)==true){
                    mmMap.put("品种名", getMergeRegionValue(sheet,i,3));
                }else{
                    mmMap.put("品种名", getCellFormatValue(sheet.getRow(i).getCell(3)));
                }
                if(isMergedRegion(sheet,i,4)==true){
                    mmMap.put("品牌", getMergeRegionValue(sheet,i,4));
                }else{
                    mmMap.put("品牌", getCellFormatValue(sheet.getRow(i).getCell(4)));
                }
                mmMap.put("型号", getCellFormatValue(sheet.getRow(i).getCell(5)));
                mmMap.put("平台编码", getCellFormatValue(sheet.getRow(i).getCell(6)));
                mmMap.put("产品名称", getCellFormatValue(sheet.getRow(i).getCell(7)));
                mmMap.put("产品规格", getCellFormatValue(sheet.getRow(i).getCell(8)));
                mmMap.put("产品型号", getCellFormatValue(sheet.getRow(i).getCell(9)));
                mmMap.put("注册证号", getCellFormatValue(sheet.getRow(i).getCell(10)));
                mmMap.put("生产企业", getCellFormatValue(sheet.getRow(i).getCell(11)));
                mmMap.put("单位", getCellFormatValue(sheet.getRow(i).getCell(12)));
                mmMap.put("平台情况", getCellFormatValue(sheet.getRow(i).getCell(13)));
                mmMap.put("进口国产", getCellFormatValue(sheet.getRow(i).getCell(14)));
                mmMap.put("平台单价", getCellFormatValue(sheet.getRow(i).getCell(15)));
                mmMap.put("是否医保", getCellFormatValue(sheet.getRow(i).getCell(16)));
                if(isMergedRegion(sheet,i,17)==true){
                    mmMap.put("问题情形", getMergeRegionValue(sheet,i,17));
                }else{
                    mmMap.put("问题情形", getCellFormatValue(sheet.getRow(i).getCell(17)));
                }
                if(isMergedRegion(sheet,i,18)==true){
                    mmMap.put("品牌情况", getMergeRegionValue(sheet,i,18));
                }else{
                    mmMap.put("品牌情况", getCellFormatValue(sheet.getRow(i).getCell(18)));
                }
                mmMap.put("备注", getCellFormatValue(sheet.getRow(i).getCell(19)));
                mmReturnList.add(mmMap);
            }

            in.close();
            return JsonResult.getSuccessResult(mmReturnList);


        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> get_haocaiyinjinvalue: "+e.getMessage());
            return JsonResult.getErrorResult("获取项目中的数据失败！");
        }
    }

    @SuppressWarnings("resource")
    @RequestMapping("get_yiyonghaocai")
    public JsonResult<?> get_yiyonghaocai(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("fileurl") String mmFileUrl,
            HttpServletRequest request){
        try {

            if(ddYiyonghaocaiService.isexistByxiangmuId(ppxianmguid)){
                return JsonResult.getErrorResult("导入失败！该项目已存在数据，请删除后再导入。");
            }

            //取出文档存放的根目录，并去除文件最后的斜杠
            if(userfilepath.endsWith("/")){
                userfilepath  = userfilepath.substring(0, userfilepath.length()-1);
            }

            mmFileUrl=mmFileUrl.substring(mmFileUrl.indexOf("importexecl"));
            String url = userfilepath+"/"+mmFileUrl;
            Workbook book = null;

            File f = new File(url);
            InputStream in = new FileInputStream(f);

            String prefix = url.substring(url.lastIndexOf(".")+1);
            if(prefix.equals("xls")) {
                book = new HSSFWorkbook(in);
            }else if(prefix.equals("xlsx")) {
                book = new XSSFWorkbook(in);
            }else {
                return JsonResult.getErrorResult("请上传xls或xlsx类型的文件！");
            }

            Sheet sheet = book.getSheetAt(0);
            if (sheet==null){
                return JsonResult.getErrorResult("请上传规范格式的EXCEL（确保上传数据在SHEET1中）！");
            }
            //int column= sheet.getRow(0).getPhysicalNumberOfCells();
            int rows = sheet.getPhysicalNumberOfRows();
            List<Map<String,Object>> mmReturnList = new ArrayList<Map<String,Object>>();

            for (int i = 2; i < rows ; i++) { //行
                Map<String,Object> mmMap = new HashMap<String,Object>();
                mmMap.put("序号", getCellFormatValue(sheet.getRow(i).getCell(0)));
                if(isMergedRegion(sheet,i,1)==true){
                    mmMap.put("品种名", getMergeRegionValue(sheet,i,1));
                }else{
                    mmMap.put("品种名", getCellFormatValue(sheet.getRow(i).getCell(1)));
                }
                if(isMergedRegion(sheet,i,2)==true){
                    mmMap.put("品种序号", getMergeRegionValue(sheet,i,2));
                }else{
                    mmMap.put("品种序号", getCellFormatValue(sheet.getRow(i).getCell(2)));
                }
                if(isMergedRegion(sheet,i,3)==true){
                    mmMap.put("品牌序号", getMergeRegionValue(sheet,i,3));
                }else{
                    mmMap.put("品牌序号", getCellFormatValue(sheet.getRow(i).getCell(3)));
                }
                mmMap.put("型号序号", getCellFormatValue(sheet.getRow(i).getCell(4)));
                mmMap.put("平台编码", getCellFormatValue(sheet.getRow(i).getCell(5)));
                mmMap.put("产品名称", getCellFormatValue(sheet.getRow(i).getCell(6)));
                mmMap.put("产品规格", getCellFormatValue(sheet.getRow(i).getCell(7)));
                mmMap.put("产品型号", getCellFormatValue(sheet.getRow(i).getCell(8)));
                mmMap.put("注册证号", getCellFormatValue(sheet.getRow(i).getCell(9)));
                mmMap.put("生产商品牌", getCellFormatValue(sheet.getRow(i).getCell(10)));
                mmMap.put("计价单位", getCellFormatValue(sheet.getRow(i).getCell(11)));
                mmMap.put("平台情况", getCellFormatValue(sheet.getRow(i).getCell(12)));
                mmMap.put("进口国产", getCellFormatValue(sheet.getRow(i).getCell(13)));
                mmMap.put("平台单价", getCellFormatValue(sheet.getRow(i).getCell(14)));
                mmMap.put("是否医保", getCellFormatValue(sheet.getRow(i).getCell(15)));
                mmMap.put("简要功能用途", getCellFormatValue(sheet.getRow(i).getCell(16)));
                mmMap.put("备注", getCellFormatValue(sheet.getRow(i).getCell(17)));
                mmMap.put("耗材分类", getCellFormatValue(sheet.getRow(i).getCell(18)));
                mmMap.put("生产商", getCellFormatValue(sheet.getRow(i).getCell(19)));
                mmMap.put("text1", getCellFormatValue(sheet.getRow(i).getCell(20)));
                mmMap.put("text2", getCellFormatValue(sheet.getRow(i).getCell(21)));
                mmMap.put("text3", getCellFormatValue(sheet.getRow(i).getCell(22)));
                mmMap.put("text4", getCellFormatValue(sheet.getRow(i).getCell(23)));
                mmMap.put("text5", getCellFormatValue(sheet.getRow(i).getCell(24)));
                mmMap.put("text6", getCellFormatValue(sheet.getRow(i).getCell(25)));
                mmMap.put("text7", getCellFormatValue(sheet.getRow(i).getCell(26)));
                mmMap.put("text8", getCellFormatValue(sheet.getRow(i).getCell(27)));
                mmMap.put("text9", getCellFormatValue(sheet.getRow(i).getCell(28)));
                mmReturnList.add(mmMap);
            }

            in.close();
            return JsonResult.getSuccessResult(mmReturnList);


        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> get_haocaiyinjinvalue: "+e.getMessage());
            return JsonResult.getErrorResult("获取项目中的数据失败！");
        }
    }

    @SuppressWarnings("resource")
    @RequestMapping("get_tiwaizhenduan")
    public JsonResult<?> get_tiwaizhenduan(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("fileurl") String mmFileUrl,
            HttpServletRequest request){
        try {

            if(ddTiwaizhenduanService.isexistByxiangmuId(ppxianmguid)){
                return JsonResult.getErrorResult("导入失败！该项目已存在数据，请删除后再导入。");
            }

            //取出文档存放的根目录，并去除文件最后的斜杠
            if(userfilepath.endsWith("/")){
                userfilepath  = userfilepath.substring(0, userfilepath.length()-1);
            }

            mmFileUrl=mmFileUrl.substring(mmFileUrl.indexOf("importexecl"));
            String url = userfilepath+"/"+mmFileUrl;
            Workbook book = null;

            File f = new File(url);
            InputStream in = new FileInputStream(f);

            String prefix = url.substring(url.lastIndexOf(".")+1);
            if(prefix.equals("xls")) {
                book = new HSSFWorkbook(in);
            }else if(prefix.equals("xlsx")) {
                book = new XSSFWorkbook(in);
            }else {
                return JsonResult.getErrorResult("请上传xls或xlsx类型的文件！");
            }

            Sheet sheet = book.getSheetAt(0);
            if (sheet==null){
                return JsonResult.getErrorResult("请上传规范格式的EXCEL（确保上传数据在SHEET1中）！");
            }
            int rows = sheet.getPhysicalNumberOfRows();
            List<Map<String,Object>> mmReturnList = new ArrayList<Map<String,Object>>();

            for (int i = 2; i < rows ; i++) { //行
                Map<String,Object> mmMap = new HashMap<String,Object>();
                mmMap.put("序号", getCellFormatValue(sheet.getRow(i).getCell(0)));
                if(isMergedRegion(sheet,i,1)==true){
                    mmMap.put("品种", getMergeRegionValue(sheet,i,1));
                }else{
                    mmMap.put("品种", getCellFormatValue(sheet.getRow(i).getCell(1)));
                }
                if(isMergedRegion(sheet,i,2)==true){
                    mmMap.put("品牌", getMergeRegionValue(sheet,i,2));
                }else{
                    mmMap.put("品牌", getCellFormatValue(sheet.getRow(i).getCell(2)));
                }
                mmMap.put("试剂注册证名称", getCellFormatValue(sheet.getRow(i).getCell(3)));
                mmMap.put("规格", getCellFormatValue(sheet.getRow(i).getCell(4)));
                mmMap.put("型号", getCellFormatValue(sheet.getRow(i).getCell(5)));
                mmMap.put("注册证号", getCellFormatValue(sheet.getRow(i).getCell(6)));
                mmMap.put("生产商", getCellFormatValue(sheet.getRow(i).getCell(7)));
                mmMap.put("是否封闭试剂", getCellFormatValue(sheet.getRow(i).getCell(8)));
                mmMap.put("平台情况", getCellFormatValue(sheet.getRow(i).getCell(9)));
                mmMap.put("平台编码", getCellFormatValue(sheet.getRow(i).getCell(10)));
                mmMap.put("计价单位", getCellFormatValue(sheet.getRow(i).getCell(11)));
                mmMap.put("平台单价", getCellFormatValue(sheet.getRow(i).getCell(12)));
                mmMap.put("检测项目", getCellFormatValue(sheet.getRow(i).getCell(13)));
                mmReturnList.add(mmMap);
            }

            in.close();
            return JsonResult.getSuccessResult(mmReturnList);


        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> get_tiwaizhenduan: "+e.getMessage());
            return JsonResult.getErrorResult("获取项目中的数据失败！");
        }
    }

    public static boolean isMergedRegion(Sheet sheet,int row,int column){
        int sheetMergeCount = sheet.getNumMergedRegions();
        for (int i = 0; i < sheetMergeCount; i++) {
            CellRangeAddress range = sheet.getMergedRegion(i);
            int firstColumn = range.getFirstColumn();
            int lastColumn = range.getLastColumn();
            int firstRow = range.getFirstRow();
            int lastRow = range.getLastRow();
            if (row >= firstRow && row <=lastRow){
                if (column >= firstColumn && column <= lastColumn){
                    return true;
                }
            }
        }
        return false;
    }
    public static String getMergeRegionValue(Sheet sheet,int row,int column){
        int sheetMergeCount = sheet.getNumMergedRegions();
        for (int i = 0; i < sheetMergeCount; i++) {
            CellRangeAddress range = sheet.getMergedRegion(i);
            int firstColumn = range.getFirstColumn();
            int lastColumn = range.getLastColumn();
            int firstRow = range.getFirstRow();
            int lastRow = range.getLastRow();
            if (row >= firstRow && row <=lastRow){
                if (column >= firstColumn && column <= lastColumn){
                    Row frow = sheet.getRow(firstRow);
                    Cell cell = frow.getCell(firstColumn);
                    return getCellValue(cell);
                }
            }
        }
        return null;
    }
    public static String getCellValue(Cell cell){

        if (cell == null) return "";
        return cell.toString();
    }

    @RequestMapping("import_tiwaizhenduan")
    public JsonResult<?> importtiwaizhenduanvalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("xuhao") String ppxuhao,
            @RequestParam("pinzhong") String pppinzhong,
            @RequestParam("pinpai") String pppinpai,
            @RequestParam("zhucezhengmingcheng") String ppzhucezhengmingcheng,
            @RequestParam("guige") String ppguige,
            @RequestParam("xinghao") String ppxinghao,
            @RequestParam("zhucezhenghao") String ppzhucezhenghao,
            @RequestParam("shengchanshang") String ppshengchanshang,
            @RequestParam("shifoufengbi") String ppshifoufengbi,
            @RequestParam("pingtaiqingkuang") String pppingtaiqingkuang,
            @RequestParam("pingtaibianma") String pppingtaibianma,
            @RequestParam("jijiadanwei") String ppjijiadanwei,
            @RequestParam("pingtaidanjia") String pppingtaidanjia,
            @RequestParam("jiancexiangmu") String ppjiancexiangmu

    ){
        try {
            Tiwaizhenduan mmTiwaizhenduan=new Tiwaizhenduan();
            mmTiwaizhenduan.setId(UUID.randomUUID().toString());
            mmTiwaizhenduan.setXiangmuid(ppxianmguid);
            Double f = Double.valueOf(pppinzhong);
            int a = (int)Math.ceil(f);
            mmTiwaizhenduan.setPinzhong(a);
            mmTiwaizhenduan.setPinpai(pppinpai);
            mmTiwaizhenduan.setZhucezhengmingcheng(ppzhucezhengmingcheng);
            mmTiwaizhenduan.setGuige(ppguige);
            mmTiwaizhenduan.setXinghao(ppxinghao);
            mmTiwaizhenduan.setZhucezhenghao(ppzhucezhenghao);
            mmTiwaizhenduan.setShengchanshang(ppshengchanshang);
            mmTiwaizhenduan.setShifoufengbi(ppshifoufengbi);
            mmTiwaizhenduan.setPingtaiqingkuang(pppingtaiqingkuang);
            mmTiwaizhenduan.setPingtaibianma(pppingtaibianma);
            mmTiwaizhenduan.setJijiadanwei(ppjijiadanwei);
            mmTiwaizhenduan.setPingtaidanjia(pppingtaidanjia);
            mmTiwaizhenduan.setJiancexiangmu(ppjiancexiangmu);
            mmTiwaizhenduan.setOrdernumber(Integer.parseInt(ppxuhao));



            return ddTiwaizhenduanService.add(mmTiwaizhenduan)==true? JsonResult.getSuccessResult("导入成功")
                    : JsonResult.getErrorResult("导入失败");

        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> import_haocaiyinjin: "+e.getMessage());
            return JsonResult.getErrorResult("导入失败！");
        }
    }

    @RequestMapping("import_shiji")
    public JsonResult<?> importshijivalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("xuhao") String ppxuhao,
            @RequestParam("leibie") String ppleibie,
            @RequestParam("pinzhongming") String pppinzhongming,
            @RequestParam("pinzhongxuhao") String pppinzhongxuhao,
            @RequestParam("pinpai") String pppinpai,
            @RequestParam("xinghao") String ppxinghao,
            @RequestParam("pingtaibianma") String pppingtaibianma,
            @RequestParam("chanpinmingcheng") String ppchanpinmingcheng,
            @RequestParam("chanpinguige") String ppchanpinguige,
            @RequestParam("chanpinxinghao") String ppchanpinxinghao,
            @RequestParam("zhucezhenghao") String ppzhucezhenghao,
            @RequestParam("shengchanqiye") String ppshengchanqiye,
            @RequestParam("danwei") String ppdanwei,
            @RequestParam("pingtaiqingkuang") String pppingtaiqingkuang,
            @RequestParam("jinkouguochan") String ppjinkouguochan,
            @RequestParam("cankaodanjia") String ppcankaodanjia,
            @RequestParam("gongnengyongtu") String ppgongnengyongtu,
            @RequestParam("yibao") String ppyibao,
            @RequestParam("pinpaiqingkuang") String pppinpaiqingkuang,
            @RequestParam("beizhu") String ppbeizhu
    ){
        try {
            Shiji mmShiji=new Shiji();
            mmShiji.setId(UUID.randomUUID().toString());
            mmShiji.setXiangmuid(ppxianmguid);
            mmShiji.setLeibie(ppleibie);
            mmShiji.setPinzhongming(pppinzhongming);
            Double f = Double.valueOf(pppinzhongxuhao);
            int a = (int)Math.ceil(f);
            mmShiji.setPinzhongxuhao(a);
            mmShiji.setPinpai(pppinpai);
            mmShiji.setXinghao(ppxinghao);
            if(pppingtaibianma.length()>200){
                mmShiji.setPingtaibianma(pppingtaibianma.substring(0,190)+"...");
            }else{
                mmShiji.setPingtaibianma(pppingtaibianma);
            }
            mmShiji.setChanpinmingcheng(ppchanpinmingcheng);
            if(ppchanpinguige.length()>200){
                mmShiji.setChanpinguige(ppchanpinguige.substring(0,190)+"...");
            }else{
                mmShiji.setChanpinguige(ppchanpinguige);
            }
            if(ppchanpinxinghao.length()>200){
                mmShiji.setChanpinxinghao(ppchanpinxinghao.substring(0,190)+"...");
            }else{
                mmShiji.setChanpinxinghao(ppchanpinxinghao);
            }
            mmShiji.setZhucezhenghao(ppzhucezhenghao);
            mmShiji.setShengchanqiye(ppshengchanqiye);
            mmShiji.setDanwei(ppdanwei);
            mmShiji.setCankaodanjia(ppcankaodanjia);
            mmShiji.setPingtaiqingkuang(pppingtaiqingkuang);
            mmShiji.setJinkouguochan(ppjinkouguochan);
            if(ppgongnengyongtu.length()>200){
                mmShiji.setGongnengyongtu(ppgongnengyongtu.substring(0,190)+"...");
            }else{
                mmShiji.setGongnengyongtu(ppgongnengyongtu);
            }
            mmShiji.setOrdernumber(Integer.parseInt(ppxuhao));
            if(ppyibao.length()>200){
                mmShiji.setYibao(ppyibao.substring(0,190)+"...");
            }else{
                mmShiji.setYibao(ppyibao);
            }
            mmShiji.setPinpaiqingkuang(pppinpaiqingkuang);
            mmShiji.setBeizhu(ppbeizhu);

            return ddShijiService.add(mmShiji)==true? JsonResult.getSuccessResult("导入成功")
                    : JsonResult.getErrorResult("导入失败");

        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> import_shiji: "+e.getMessage());
            return JsonResult.getErrorResult("导入失败！");
        }
    }


    @RequestMapping("import_yiyonghaocai")
    public JsonResult<?> importyiyonghaocaivalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("xuhao") String ppxuhao,
            @RequestParam("haocaifenlei") String pphaocaifenlei,
            @RequestParam("pinzhongming") String pppinzhongming,
            @RequestParam("pinzhongxuhao") String pppinzhongxuhao,
            @RequestParam("pinpaixuhao") String pppinpaixuhao,
            @RequestParam("xinghaoxuhao") String ppxinghaoxuhao,
            @RequestParam("pingtaibianma") String pppingtaibianma,
            @RequestParam("chanpinmingcheng") String ppchanpinmingcheng,
            @RequestParam("chanpinguige") String ppchanpinguige,
            @RequestParam("chanpinxinghao") String ppchanpinxinghao,
            @RequestParam("zhucezhenghao") String ppzhucezhenghao,
            @RequestParam("shengchanshangpinpai") String ppshengchanshangpinpai,
            @RequestParam("shengchanshang") String ppshengchanshang,
            @RequestParam("jijiadanwei") String ppjijiadanwei,
            @RequestParam("pingtaiqingkuang") String pppingtaiqingkuang,
            @RequestParam("jinkouguochan") String ppjinkouguochan,
            @RequestParam("pingtaidanjia") String pppingtaidanjia,
            @RequestParam("gongnengyongtu") String ppgongnengyongtu,
            @RequestParam("shifouyibao") String ppshifouyibao,
            @RequestParam("beizhu") String ppbeizhu,
            @RequestParam("text1") String text1,
            @RequestParam("text2") String text2,
            @RequestParam("text3") String text3,
            @RequestParam("text4") String text4,
            @RequestParam("text5") String text5,
            @RequestParam("text6") String text6,
            @RequestParam("text7") String text7,
            @RequestParam("text8") String text8,
            @RequestParam("text9") String text9
    ){
        try {
            Yiyonghaocai mmYiyonghaocai=new Yiyonghaocai();
            mmYiyonghaocai.setId(UUID.randomUUID().toString());
            mmYiyonghaocai.setXiangmuid(ppxianmguid);
            mmYiyonghaocai.setHaocaifenlei(pphaocaifenlei);
            mmYiyonghaocai.setPinzhongming(pppinzhongming);
            Double f = Double.valueOf(pppinzhongxuhao);
            int a = (int)Math.ceil(f);
            mmYiyonghaocai.setPinzhongxuhao(a);
            mmYiyonghaocai.setPinpaixuhao(pppinpaixuhao);
            mmYiyonghaocai.setXinghaoxuhao(ppxinghaoxuhao);
            mmYiyonghaocai.setPingtaibianma(pppingtaibianma);
            mmYiyonghaocai.setChanpinmingcheng(ppchanpinmingcheng);
            if(ppchanpinguige.length()>200){
                mmYiyonghaocai.setChanpinguige(ppchanpinguige.substring(0,200)+"...");
            }else{
                mmYiyonghaocai.setChanpinguige(ppchanpinguige);
            }
            if(ppchanpinxinghao.length()>200){
                mmYiyonghaocai.setChanpinxinghao(ppchanpinxinghao.substring(0,200)+"...");
            }else{
                mmYiyonghaocai.setChanpinxinghao(ppchanpinxinghao);
            }
            mmYiyonghaocai.setZhucezhenghao(ppzhucezhenghao);
            mmYiyonghaocai.setShengchanshangpinpai(ppshengchanshangpinpai);
            mmYiyonghaocai.setShengchanshang(ppshengchanshang);
            mmYiyonghaocai.setJijiadanwei(ppjijiadanwei);
            mmYiyonghaocai.setPingtaiqingkuang(pppingtaiqingkuang);
            mmYiyonghaocai.setJinkouguochan(ppjinkouguochan);
            mmYiyonghaocai.setPingtaidanjia(pppingtaidanjia);
            if(ppgongnengyongtu.length()>200){
                mmYiyonghaocai.setGongnengyongtu(ppgongnengyongtu.substring(0,200)+"...");
            }else{
                mmYiyonghaocai.setGongnengyongtu(ppgongnengyongtu);
            }
            mmYiyonghaocai.setOrdernumber(Integer.parseInt(ppxuhao));
            mmYiyonghaocai.setText1(text1);
            mmYiyonghaocai.setText2(text2);
            mmYiyonghaocai.setText3(text3);
            mmYiyonghaocai.setText4(text4);
            mmYiyonghaocai.setText5(text5);
            mmYiyonghaocai.setText6(text6);
            mmYiyonghaocai.setText7(text7);
            mmYiyonghaocai.setText8(text8);
            mmYiyonghaocai.setText9(text9);
            mmYiyonghaocai.setText10(ppshifouyibao);
            mmYiyonghaocai.setText11(ppbeizhu);



            return ddYiyonghaocaiService.add(mmYiyonghaocai)==true? JsonResult.getSuccessResult("导入成功")
                    : JsonResult.getErrorResult("导入失败");

        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> import_yiyonghaocai: "+e.getMessage());
            return JsonResult.getErrorResult("导入失败！");
        }
    }


    @RequestMapping("import_haocaiyinjin")
    public JsonResult<?> importhaocaiyinjinvalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("xuhao") String ppxuhao,
            @RequestParam("pinzhong") String pppinzhong,
            @RequestParam("pinpai") String pppinpai,
            @RequestParam("xinghaochaifen") String ppxinghaochaifen,
            @RequestParam("pingtaibianma") String pppingtaibianma,
            @RequestParam("zhucezhengmingcheng") String ppzhucezhengmingcheng,
            @RequestParam("guige") String ppguige,
            @RequestParam("xinghao") String ppxinghao,
            @RequestParam("zhucezhenghao") String ppzhucezhenghao,
            @RequestParam("shengchanshang") String ppshengchanshang,
            @RequestParam("jijiadanwei") String ppjijiadanwei,
            @RequestParam("pingtaiqingkuang") String pppingtaiqingkuang,
            @RequestParam("pingtaidanjia") String pppingtaidanjia,
            @RequestParam("nanjingshiyibaoma") String ppnanjingshiyibaoma,
            @RequestParam("gongnengyongtu") String ppgongnengyongtu

    ){
        try {
            Haocaiyinjin mmHaocaiyinjin=new Haocaiyinjin();
            mmHaocaiyinjin.setId(UUID.randomUUID().toString());
            mmHaocaiyinjin.setXiangmuid(ppxianmguid);
            Double f = Double.valueOf(pppinzhong);
            int a = (int)Math.ceil(f);
            mmHaocaiyinjin.setPinzhong(a);
            mmHaocaiyinjin.setPinpai(pppinpai);
            mmHaocaiyinjin.setXinghaochaifen(ppxinghaochaifen);
            mmHaocaiyinjin.setPingtaibianma(pppingtaibianma);
            mmHaocaiyinjin.setZhucezhengmingcheng(ppzhucezhengmingcheng);
            mmHaocaiyinjin.setGuige(ppguige);
            mmHaocaiyinjin.setXinghao(ppxinghao);
            mmHaocaiyinjin.setZhucezhenghao(ppzhucezhenghao);
            mmHaocaiyinjin.setShengchanshang(ppshengchanshang);
            mmHaocaiyinjin.setJijiadanwei(ppjijiadanwei);
            mmHaocaiyinjin.setPingtaiqingkuang(pppingtaiqingkuang);
            mmHaocaiyinjin.setPingtaidanjia(pppingtaidanjia);
            mmHaocaiyinjin.setNanjingshiyibaoma(ppnanjingshiyibaoma);
            mmHaocaiyinjin.setGongnengyongtu(ppgongnengyongtu);
            mmHaocaiyinjin.setOrdernumber(Integer.parseInt(ppxuhao));



            return ddHaocaiyinjinService.add(mmHaocaiyinjin)==true? JsonResult.getSuccessResult("导入成功")
                    : JsonResult.getErrorResult("导入失败");

        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> import_haocaiyinjin: "+e.getMessage());
            return JsonResult.getErrorResult("导入失败！");
        }
    }
    //设备
    @RequestMapping("import_shebei")
    public JsonResult<?> importshebeivalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("yuanqu") String ppyuanqu,
            @RequestParam("xuhao") String ppxuhao,
            @RequestParam("shiyongkeshi") String ppshiyongkeshi,
            @RequestParam("shebeimingcheng") String ppshebeimingcheng,
            @RequestParam("xinghao") String ppxinghao,
            @RequestParam("taijianshu") String pptaijianshu,
            @RequestParam("shengchanchangshang") String ppshengchanchangshang,
            @RequestParam("xuliehao") String ppxuliehao,
            @RequestParam("qiyongshijian") String ppqiyongshijian,
            @RequestParam("shebeigongsi") String ppshebeigongsi,
            @RequestParam("guishu") String ppguishu,
            @RequestParam("leibie") String ppleibie,
            @RequestParam("liyou") String ppliyou

    ){
        try {
            Shebei mmShebei=new Shebei();
            mmShebei.setId(UUID.randomUUID().toString());
            mmShebei.setXiangmuid(ppxianmguid);
            mmShebei.setYuanqu(ppyuanqu);
            mmShebei.setOrdernumber(Integer.parseInt(ppxuhao));
            mmShebei.setShiyongkeshi(ppshiyongkeshi);
            mmShebei.setShebeimingcheng(ppshebeimingcheng);
            mmShebei.setXinghao(ppxinghao);
            mmShebei.setTaijianshu(pptaijianshu);
            mmShebei.setShengchanchangshang(ppshengchanchangshang);
            mmShebei.setXuliehao(ppxuliehao);
            mmShebei.setQiyongshijian(ppqiyongshijian);
            mmShebei.setShebeigongsi(ppshebeigongsi);
            mmShebei.setGuishu(ppguishu);
            mmShebei.setLeibie(ppleibie);
            if(ppliyou.length()>255){
                mmShebei.setLiyou(ppliyou.substring(0,255)+"...");
            }else{
                mmShebei.setLiyou(ppliyou);
            }
            return ddShebeiService.add(mmShebei)==true? JsonResult.getSuccessResult("导入成功")
                    : JsonResult.getErrorResult("导入失败");
        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> import_shebie: "+e.getMessage());
            return JsonResult.getErrorResult("导入失败！");
        }
    }
    //引进
    @RequestMapping("import_yinjin")
    public JsonResult<?> importyinjinvalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("xuhao") String ppxuhao,
            @RequestParam("shiyongkeshi") String ppshiyongkeshi,
            @RequestParam("shebeimingcheng") String ppshebeimingcheng,
            @RequestParam("shuliang") String ppshuliang,
            @RequestParam("danjia") String ppdanjia,
            @RequestParam("yusuanjine") String ppyusuanjine,
            @RequestParam("shebeileixing") String ppshebeileixing,
            @RequestParam("tongyongmingcheng") String pptongyongmingcheng,
            @RequestParam("beizhu1") String ppbeizhu1,
            @RequestParam("beizhu2") String ppbeizhu2,
            @RequestParam("beizhu") String ppbeizhu

    ){
        try {
            YltpYinjin mmYltpYinjin=new YltpYinjin();
            mmYltpYinjin.setId(UUID.randomUUID().toString());
            mmYltpYinjin.setXiangmuid(ppxianmguid);
            mmYltpYinjin.setShiyongkeshi(ppshiyongkeshi);
            mmYltpYinjin.setShebeimingcheng(ppshebeimingcheng);
            mmYltpYinjin.setShuliang(ppshuliang);
            mmYltpYinjin.setDanjia(ppdanjia);
            mmYltpYinjin.setYusuanjine(ppyusuanjine);
            mmYltpYinjin.setShebeileixing(ppshebeileixing);
            mmYltpYinjin.setTongyongmingcheng(pptongyongmingcheng);
            if(ppbeizhu.length()>500){
                mmYltpYinjin.setBeizhu(ppbeizhu.substring(0,500)+"...");
            }else{
                mmYltpYinjin.setBeizhu(ppbeizhu);
            }
            if(ppbeizhu1.length()>500){
                mmYltpYinjin.setBeizhu1(ppbeizhu1.substring(0,500)+"...");
            }else{
                mmYltpYinjin.setBeizhu1(ppbeizhu1);
            }
            mmYltpYinjin.setBeizhu2(ppbeizhu2);
            mmYltpYinjin.setOrdernumber(Integer.parseInt(ppxuhao));

            return ddYltpyinjinService.add(mmYltpYinjin)==true? JsonResult.getSuccessResult("导入引进成功")
                    : JsonResult.getErrorResult("导入引进失败");

        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> import_yinjin: "+e.getMessage());
            return JsonResult.getErrorResult("导入引进失败！");
        }
    }

    @RequestMapping("import_dailiang")
    public JsonResult<?> importdailiangvalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("dailiangpici") String ppdailiangpici,
            @RequestParam("xuhao") String ppxuhao,
            @RequestParam("chanpinfeilei") String ppchanpinfeilei,
            @RequestParam("zhongbiaobianma") String ppzhongbiaobianma,
            @RequestParam("chanpinmingcheng") String ppchanpinmingcheng,
            @RequestParam("chanpinguige") String ppchanpinguige,
            @RequestParam("chanpinxinghao") String ppchanpinxinghao,
            @RequestParam("zhecezhenghao") String ppzhecezhenghao,
            @RequestParam("shengchanchangjia") String ppshengchanchangjia,
            @RequestParam("danwei") String ppdanwei,
            @RequestParam("danjia") String ppdanjia

    ){
        try {
            Dailiangchuangxin mmDailiangchuangxin=new Dailiangchuangxin();
            mmDailiangchuangxin.setId(UUID.randomUUID().toString());
            mmDailiangchuangxin.setXiangmuid(ppxianmguid);
            mmDailiangchuangxin.setDailiangpici(ppdailiangpici);
            mmDailiangchuangxin.setChanpinfenlei(ppchanpinfeilei);
            mmDailiangchuangxin.setZhongbiaobianma(ppzhongbiaobianma);
            mmDailiangchuangxin.setChanpinmingcheng(ppchanpinmingcheng);
            if(ppchanpinguige.length()>200){
                mmDailiangchuangxin.setChanpinguige(ppchanpinguige.substring(0,190)+"...");
            }else{
                mmDailiangchuangxin.setChanpinguige(ppchanpinguige);
            }
            if(ppchanpinxinghao.length()>200){
                mmDailiangchuangxin.setChanpinxinghao(ppchanpinxinghao.substring(0,190)+"...");
            }else{
                mmDailiangchuangxin.setChanpinxinghao(ppchanpinxinghao);
            }
            mmDailiangchuangxin.setZhecezhenghao(ppzhecezhenghao);
            mmDailiangchuangxin.setShengchanchangjia(ppshengchanchangjia);
            mmDailiangchuangxin.setDanwei(ppdanwei);
            mmDailiangchuangxin.setDanjia(ppdanjia);
            mmDailiangchuangxin.setOrdernumber(Integer.parseInt(ppxuhao));

            return ddDailiangchuangxinService.add(mmDailiangchuangxin)==true? JsonResult.getSuccessResult("导入成功")
                    : JsonResult.getErrorResult("导入失败");

        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> import_dailiang: "+e.getMessage());
            return JsonResult.getErrorResult("导入失败！");
        }
    }

    @RequestMapping("import_baofei")
    public JsonResult<?> importbaofeivalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("xuhao") String ppxuhao,
            @RequestParam("shiyongkeshi") String ppshiyongkeshi,
            @RequestParam("shebeimingcheng") String ppshebeimingcheng,
            @RequestParam("guigexinghao") String ppguigexinghao,
            @RequestParam("shebeijiazhi") String ppshebeijiazhi,
            @RequestParam("shuliang") String ppshuliang,
            @RequestParam("shengchanchangshang") String ppshengchanchangshang,
            @RequestParam("laiyuan") String pplaiyuan,
            @RequestParam("caigoushijian") String ppcaigoushijian

    ){
        try {
            YltpBaofei mmYltpBaofei=new YltpBaofei();
            mmYltpBaofei.setId(UUID.randomUUID().toString());
            mmYltpBaofei.setXiangmuid(ppxianmguid);
            mmYltpBaofei.setShiyongkeshi(ppshiyongkeshi);
            mmYltpBaofei.setShebeimingcheng(ppshebeimingcheng);
            mmYltpBaofei.setGuigexinghao(ppguigexinghao);
            mmYltpBaofei.setShebeijiazhi(ppshebeijiazhi);
            mmYltpBaofei.setShuliang(ppshuliang);
            mmYltpBaofei.setShengchanchangshang(ppshengchanchangshang);
            mmYltpBaofei.setLaiyuan(pplaiyuan);
            mmYltpBaofei.setCaigoushijian(ppcaigoushijian);
            mmYltpBaofei.setOrdernumber(Integer.parseInt(ppxuhao));
            return ddYltpbaofeiService.add(mmYltpBaofei)==true? JsonResult.getSuccessResult("导入报废成功")
                    : JsonResult.getErrorResult("导入报废失败");
        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> import_baofei: "+e.getMessage());
            return JsonResult.getErrorResult("导入报废失败！");
        }
    }

    @RequestMapping("import_haocaiduibiao")
    public JsonResult<?> importhaocaiduibiaovalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("xuhao") String ppxuhao,
            @RequestParam("mingcheng") String ppmingcheng,
            @RequestParam("guige") String ppguige,
            @RequestParam("zhucezhengmingcheng") String ppzhucezhengmingcheng,
            @RequestParam("zhucezhengguige") String ppzhucezhengguige,
            @RequestParam("zhucezhenghao") String ppzhucezhenghao,
            @RequestParam("shengchanchangjia") String ppshengchanchangjia,
            @RequestParam("jijiadanwei") String ppjijiadanwei,
            @RequestParam("caigoujia") String ppcaigoujia,
            @RequestParam("shiyongkeshi") String ppshiyongkeshi,
            @RequestParam("pingtaibianma") String pppingtaibianma

    ){
        try {
            YltpHaocaiduibiao mmYltpHaocaiduibiao=new YltpHaocaiduibiao();
            mmYltpHaocaiduibiao.setId(UUID.randomUUID().toString());
            mmYltpHaocaiduibiao.setXiangmuid(ppxianmguid);
            mmYltpHaocaiduibiao.setMingcheng(ppmingcheng);
            mmYltpHaocaiduibiao.setGuige(ppguige);
            mmYltpHaocaiduibiao.setZhucezhengmingcheng(ppzhucezhengmingcheng);
            mmYltpHaocaiduibiao.setZhucezhengguige(ppzhucezhengguige);
            mmYltpHaocaiduibiao.setZhucezhenghao(ppzhucezhenghao);
            mmYltpHaocaiduibiao.setShengchanchangjia(ppshengchanchangjia);
            mmYltpHaocaiduibiao.setJijiadanwei(ppjijiadanwei);
            mmYltpHaocaiduibiao.setCaigoujia(ppcaigoujia);
            mmYltpHaocaiduibiao.setShiyongkeshi(ppshiyongkeshi);
            mmYltpHaocaiduibiao.setPingtaibianma(pppingtaibianma);
            mmYltpHaocaiduibiao.setOrdernumber(Integer.parseInt(ppxuhao));
            return ddYltphaocaiduibiaoService.add(mmYltpHaocaiduibiao)==true? JsonResult.getSuccessResult("导入医用耗材平台对标情况表成功")
                    : JsonResult.getErrorResult("导入医用耗材平台对标情况表失败");
        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> import_haocaiduibiao: "+e.getMessage());
            return JsonResult.getErrorResult("导入医用耗材平台对标情况表失败！");
        }
    }

    @RequestMapping("import_zhuankeyinjin")
    public JsonResult<?> importzhuankeyinjinvalue(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("xuhao") String ppxuhao,
            @RequestParam("xuqiukeshi") String ppxuqiukeshi,
            @RequestParam("haocaibianhao") String pphaocaibianhao,
            @RequestParam("xianyong_mingcheng") String ppxianyong_mingcheng,
            @RequestParam("xianyong_guige") String ppxianyong_guige,
            @RequestParam("xianyong_shengchanchangjia") String ppxianyong_shengchanchangjia,
            @RequestParam("xianyong_danjia") String ppxianyong_danjia,
            @RequestParam("nigeng_mingcheng") String ppnigeng_mingcheng,
            @RequestParam("nigeng_guige") String ppnigeng_guige,
            @RequestParam("nigeng_shengchanchangjia") String ppnigeng_shengchanchangjia,
            @RequestParam("nigeng_danjia") String ppnigeng_danjia,
            @RequestParam("zhongbiaoxinxi") String ppzhongbiaoxinxi

    ){
        try {
            YltpZhuankeyinjin mmYltpZhuankeyinjin=new YltpZhuankeyinjin();
            mmYltpZhuankeyinjin.setId(UUID.randomUUID().toString());
            mmYltpZhuankeyinjin.setXiangmuid(ppxianmguid);
            mmYltpZhuankeyinjin.setXuqiukeshi(ppxuqiukeshi);
            mmYltpZhuankeyinjin.setHaocaibianhao(pphaocaibianhao);
            mmYltpZhuankeyinjin.setXianyongMingcheng(ppxianyong_mingcheng);
            mmYltpZhuankeyinjin.setXianyongGuige(ppxianyong_guige);
            mmYltpZhuankeyinjin.setXianyongShengchanchangjia(ppxianyong_shengchanchangjia);
            mmYltpZhuankeyinjin.setXianyongDanjia(ppxianyong_danjia);
            mmYltpZhuankeyinjin.setNigengMingcheng(ppnigeng_mingcheng);
            mmYltpZhuankeyinjin.setNigengGuige(ppnigeng_guige);
            mmYltpZhuankeyinjin.setNigengShengchanchangjia(ppnigeng_shengchanchangjia);
            mmYltpZhuankeyinjin.setNigengDanjia(ppnigeng_danjia);
            mmYltpZhuankeyinjin.setZhongbiaoxinxi(ppzhongbiaoxinxi);
            mmYltpZhuankeyinjin.setOrdernumber(Integer.parseInt(ppxuhao));
            return ddYltpzhuankeyinjinService.add(mmYltpZhuankeyinjin)==true? JsonResult.getSuccessResult("导入一对一专科耗材换标情况表成功")
                    : JsonResult.getErrorResult("导入一对一专科耗材换标情况表失败");
        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> import_zhuankeyinjin: "+e.getMessage());
            return JsonResult.getErrorResult("导入一对一专科耗材换标情况表失败！");
        }
    }
    @Transactional
    @RequestMapping("get_Fujian")
    public JsonResult<?> get_Fujian(
            @RequestParam("xianmguid") String ppxianmguid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing,
            @RequestParam("fileurl") String mmFileUrl,
            HttpServletRequest request){
        try {

            if(fujianService.isexistByxiangmuId(ppxianmguid,ppxiangmuleixing)){
                return JsonResult.getErrorResult("导入失败！该项目已存在数据，请删除后再导入。");
            }

            //取出文档存放的根目录，并去除文件最后的斜杠
            if(userfilepath.endsWith("/")){
                userfilepath  = userfilepath.substring(0, userfilepath.length()-1);
            }

            mmFileUrl=mmFileUrl.substring(mmFileUrl.indexOf("importexecl"));
            String url = userfilepath+"/"+mmFileUrl;
            Workbook book = null;

            File f = new File(url);
            InputStream in = new FileInputStream(f);

            String prefix = url.substring(url.lastIndexOf(".")+1);
            if(prefix.equals("xls")) {
                book = new HSSFWorkbook(in);
            }else if(prefix.equals("xlsx")) {
                book = new XSSFWorkbook(in);
            }else {
                return JsonResult.getErrorResult("请上传xls或xlsx类型的文件！");
            }

            Sheet sheet = book.getSheetAt(0);
            if (sheet==null){
                return JsonResult.getErrorResult("请上传规范格式的EXCEL（确保上传数据在SHEET1中）！");
            }
            int rows = sheet.getPhysicalNumberOfRows();

            int result=-1;
            if(ppxiangmuleixing.equals("18")) {
                List<Hc3> mmReturnList = new ArrayList<>();
                for (int i = 4; i < rows; i++) { //行
                    Hc3 item = new Hc3();
                    item.setId(UUID.randomUUID().toString());
                    item.setXiangmuid(ppxianmguid);
                    item.setBeizhu1(getCellFormatValue(sheet.getRow(i).getCell(0)).toString());//引进类型
                    item.setXuhao(Integer.parseInt(getCellFormatValue(sheet.getRow(i).getCell(1)).toString()));//序号
                    item.setBeizhu2(getCellFormatValue(sheet.getRow(i).getCell(2)).toString());//带量备注
                    item.setBeizhu3(getCellFormatValue(sheet.getRow(i).getCell(3)).toString());//产品类别
                    item.setZhongbiaobianma(getCellFormatValue(sheet.getRow(i).getCell(4)).toString());//中标编码
                    item.setBeizhu4(getCellFormatValue(sheet.getRow(i).getCell(5)).toString());//注册证名称
                    item.setGuige(getCellFormatValue(sheet.getRow(i).getCell(6)).toString());//规格
                    item.setXinghao(getCellFormatValue(sheet.getRow(i).getCell(7)).toString());//型号
                    item.setZhucezheng(getCellFormatValue(sheet.getRow(i).getCell(8)).toString());//注册证号
                    item.setShengchanchangjia(getCellFormatValue(sheet.getRow(i).getCell(9)).toString());//生产商
                    item.setDanwei(getCellFormatValue(sheet.getRow(i).getCell(10)).toString());//单位
                    item.setDanjia(getCellFormatValue(sheet.getRow(i).getCell(11)).toString());//价格
                    item.setBeizhu5(getCellFormatValue(sheet.getRow(i).getCell(12)).toString());//备注
                    item.setOrdernum(i-3);
                    item.setIsvote(1);
                    mmReturnList.add(item);
                }
                result =  hc3Mapper.insertBatch(mmReturnList);
            }
            if(ppxiangmuleixing.equals("19")) {
                List<Hc2> mmReturnList = new ArrayList<>();
                for (int i = 5; i < rows; i++) { //行
                    Hc2 item = new Hc2();
                    item.setId(UUID.randomUUID().toString());
                    item.setXiangmuid(ppxianmguid);
                    item.setYinjinleixing(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(0))));
                    item.setZongxuhao(Integer.parseInt(getCellFormatValue(sheet.getRow(i).getCell(1)).toString()));
                    item.setShebeimingcheng(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(2))));
                    item.setShebeixinghao(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(3))));
                    item.setShebeilaiyuan(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(4))));
                    item.setBeizhu1(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(5))));//设备品牌
                    item.setPingtaibianma(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(6))));
                    item.setChanpinmingcheng(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(7))));
                    item.setGuige(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(8))));
                    item.setXinghao(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(9))));
                    item.setZhucezhenghao(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(10))));
                    item.setShengchanchangjia(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(11))));
                    item.setDanwei(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(12))));
                    item.setDanjia(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(13))));
                    item.setYibaobianma(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(14))));
                    item.setGuochanjinkou(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(15))));
                    item.setBeizhu(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(16))));
                    item.setShenqingkeshi(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(17))));
                    item.setOrdernum(i-4);
                    item.setIsvote(1);

                    mmReturnList.add(item);
                }
                result =  hc2Mapper.insertBatch(mmReturnList);
            }
            if(ppxiangmuleixing.equals("20")) {
                List<Hc2> mmReturnList = new ArrayList<>();
                for (int i = 5; i < rows; i++) { //行
                    Hc2 item = new Hc2();
                    item.setId(UUID.randomUUID().toString());
                    item.setXiangmuid(ppxianmguid);
                    item.setYinjinleixing(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(0))));
                    item.setZongxuhao(Integer.parseInt(getCellFormatValue(sheet.getRow(i).getCell(1)).toString()));
                    item.setShebeimingcheng(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(2))));
                    item.setShebeixinghao(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(3))));
                    item.setShebeilaiyuan(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(4))));
                    item.setQiyongriqi(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(5))));
                    item.setShebeixuliehao(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(6))));
                    item.setShebeishengchanchangjia(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(7))));
                    item.setPingtaibianma(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(8))));
                    item.setChanpinmingcheng(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(9))));
                    item.setGuige(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(10))));
                    item.setXinghao(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(11))));
                    item.setZhucezhenghao(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(12))));
                    item.setShengchanchangjia(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(13))));
                    item.setDanwei(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(14))));
                    item.setDanjia(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(15))));
                    item.setYibaobianma(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(16))));
                    item.setGuochanjinkou(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(17))));
                    item.setBeizhu(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(18))));
                    item.setShenqingkeshi(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(19))));
                    item.setOrdernum(i-4);
                    item.setIsvote(1);

                    mmReturnList.add(item);
                }
                result =  hc2Mapper.insertBatch(mmReturnList);
            }
            if(ppxiangmuleixing.equals("24")||ppxiangmuleixing.equals("25")||
                    ppxiangmuleixing.equals("26")||ppxiangmuleixing.equals("27")||
                    ppxiangmuleixing.equals("28")||ppxiangmuleixing.equals("29")) {
                List<Hc45> mmReturnList = new ArrayList<>();
                for (int i = 4; i < rows; i++) { //行
                    Hc45 item = new Hc45();
                    item.setId(UUID.randomUUID().toString());
                    item.setXiangmuid(ppxianmguid);
                    item.setYinjinleixing(getCellFormatValue(sheet.getRow(i).getCell(0)).toString());
                    item.setZongxuhao(Integer.parseInt(getCellFormatValue(sheet.getRow(i).getCell(1)).toString()));
                    item.setPinzhongming(getCellFormatValue(sheet.getRow(i).getCell(2)).toString());
                    item.setPinpai(getCellFormatValue(sheet.getRow(i).getCell(3)).toString());
                    item.setPingtaibianma(getCellFormatValue(sheet.getRow(i).getCell(4)).toString());
                    item.setChanpinmingcheng(getCellFormatValue(sheet.getRow(i).getCell(5)).toString());
                    item.setGuige(getCellFormatValue(sheet.getRow(i).getCell(6)).toString());
                    item.setXinghao(getCellFormatValue(sheet.getRow(i).getCell(7)).toString());
                    item.setZhucezheng(getCellFormatValue(sheet.getRow(i).getCell(8)).toString());
                    item.setPinpaiming(getCellFormatValue(sheet.getRow(i).getCell(9)).toString());
                    item.setDanwei(getCellFormatValue(sheet.getRow(i).getCell(10)).toString());
                    item.setDanjia(getCellFormatValue(sheet.getRow(i).getCell(11)).toString());
                    item.setYibaobianma(getCellFormatValue(sheet.getRow(i).getCell(12)).toString());
                    item.setGuochanjinkou(getCellFormatValue(sheet.getRow(i).getCell(13)).toString());
                    item.setBeizhu(getCellFormatValue(sheet.getRow(i).getCell(14)).toString());
                    item.setKeshi(getCellFormatValue(sheet.getRow(i).getCell(15)).toString());//申请科室

                    item.setOrdernum(i-3);
                    item.setIsvote(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(18))).isEmpty()? 0 : 1);
                    mmReturnList.add(item);
                }
                result =  hc45Mapper.insertBatch(mmReturnList);
            }
//            if(ppxiangmuleixing.equals("22")) {
//                List<Hc45> mmReturnList = new ArrayList<>();
//                for (int i = 4; i < rows; i++) { //行
//                    Hc45 item = new Hc45();
//                    item.setId(UUID.randomUUID().toString());
//                    item.setXiangmuid(ppxianmguid);
//                    item.setYinjinleixing(getCellFormatValue(sheet.getRow(i).getCell(0)).toString());
//                    item.setZongxuhao(Integer.parseInt(getCellFormatValue(sheet.getRow(i).getCell(1)).toString()));
//                    item.setPinzhongming(getCellFormatValue(sheet.getRow(i).getCell(2)).toString());
//                    item.setPinpai(getCellFormatValue(sheet.getRow(i).getCell(3)).toString());
//                    item.setPingtaibianma(getCellFormatValue(sheet.getRow(i).getCell(4)).toString());
//                    item.setChanpinmingcheng(getCellFormatValue(sheet.getRow(i).getCell(5)).toString());
//                    item.setGuige(getCellFormatValue(sheet.getRow(i).getCell(6)).toString());
//                    item.setXinghao(getCellFormatValue(sheet.getRow(i).getCell(7)).toString());
//                    item.setZhucezheng(getCellFormatValue(sheet.getRow(i).getCell(8)).toString());
//                    item.setPinpaiming(getCellFormatValue(sheet.getRow(i).getCell(9)).toString());
//                    item.setDanwei(getCellFormatValue(sheet.getRow(i).getCell(10)).toString());
//                    item.setDanjia(getCellFormatValue(sheet.getRow(i).getCell(11)).toString());
//                    item.setYibaobianma(getCellFormatValue(sheet.getRow(i).getCell(12)).toString());
//                    item.setGuochanjinkou(getCellFormatValue(sheet.getRow(i).getCell(13)).toString());
//                    item.setBeizhu(getCellFormatValue(sheet.getRow(i).getCell(14)).toString());
//                    item.setKeshi(getCellFormatValue(sheet.getRow(i).getCell(15)).toString());//申请科室
//
//                    item.setOrdernum(i-3);
//                    item.setIsvote(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(18))).isEmpty()? 0 : 1);
//                    mmReturnList.add(item);
//                }
//                result =  hc45Mapper.insertBatch(mmReturnList);
//            }
            if(ppxiangmuleixing.equals("23")) {
                List<Hc3> mmReturnList = new ArrayList<>();
                for (int i = 4; i < rows; i++) { //行
                    Hc3 item = new Hc3();
                    item.setId(UUID.randomUUID().toString());
                    item.setXiangmuid(ppxianmguid);
                    item.setBeizhu1(getCellFormatValue(sheet.getRow(i).getCell(0)).toString());//引进类型
                    item.setXuhao(Integer.parseInt(getCellFormatValue(sheet.getRow(i).getCell(1)).toString()));//序号
                    item.setBeizhu2(getCellFormatValue(sheet.getRow(i).getCell(2)).toString());//带量备注
                    item.setBeizhu3(getCellFormatValue(sheet.getRow(i).getCell(3)).toString());//产品类别
                    item.setZhongbiaobianma(getCellFormatValue(sheet.getRow(i).getCell(4)).toString());//中标编码
                    item.setBeizhu4(getCellFormatValue(sheet.getRow(i).getCell(5)).toString());//注册证名称
                    item.setGuige(getCellFormatValue(sheet.getRow(i).getCell(6)).toString());//规格
                    item.setXinghao(getCellFormatValue(sheet.getRow(i).getCell(7)).toString());//型号
                    item.setZhucezheng(getCellFormatValue(sheet.getRow(i).getCell(8)).toString());//注册证号
                    item.setShengchanchangjia(getCellFormatValue(sheet.getRow(i).getCell(9)).toString());//生产商
                    item.setDanwei(getCellFormatValue(sheet.getRow(i).getCell(10)).toString());//单位
                    item.setDanjia(getCellFormatValue(sheet.getRow(i).getCell(11)).toString());//价格
                    item.setBeizhu5(getCellFormatValue(sheet.getRow(i).getCell(12)).toString());//备注
                    item.setOrdernum(i-3);
                    item.setIsvote(1);
                    mmReturnList.add(item);
                }
                result =  hc3Mapper.insertBatch(mmReturnList);
            }
//            if(ppxiangmuleixing.equals("13")) {
//                List<Hc2> mmReturnList = new ArrayList<>();
//                for (int i = 5; i < rows; i++) { //行
//                    Hc2 item = new Hc2();
//                    item.setId(UUID.randomUUID().toString());
//                    item.setXiangmuid(ppxianmguid);
//                    item.setYinjinleixing(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(0))));
//                    item.setZongxuhao(Integer.parseInt(getCellFormatValue(sheet.getRow(i).getCell(1)).toString()));
//                    item.setShebeimingcheng(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(3))));
//                    item.setShebeixinghao(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(4))));
//                    item.setShebeilaiyuan(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(5))));
//                    item.setQiyongriqi(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(6))));
//                    item.setShebeixuliehao(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(7))));
//                    item.setShebeishengchanchangjia(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(8))));
//                    item.setPingtaibianma(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(9))));
//                    item.setChanpinmingcheng(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(10))));
//                    item.setGuige(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(11))));
//                    item.setXinghao(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(12))));
//                    item.setZhucezhenghao(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(13))));
//                    item.setShengchanchangjia(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(14))));
//                    item.setDanwei(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(15))));
//                    item.setDanjia(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(16))));
//                    item.setYibaobianma(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(17))));
//                    item.setGuochanjinkou(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(18))));
//                    item.setBeizhu(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(19))));
//                    item.setShenqingkeshi(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(20))));
//                    item.setOrdernum(i-4);
//                    item.setIsvote(1);
//
//                    mmReturnList.add(item);
//                }
//                result =  hc2Mapper.insertBatch(mmReturnList);
//            }
//            if(ppxiangmuleixing.equals("14")) {
//                List<Hc3> mmReturnList = new ArrayList<>();
//                for (int i = 4; i < rows; i++) { //行
//                    Hc3 item = new Hc3();
//                    item.setId(UUID.randomUUID().toString());
//                    item.setXiangmuid(ppxianmguid);
//                    item.setBeizhu1(getCellFormatValue(sheet.getRow(i).getCell(0)).toString());//引进类型
//                    item.setXuhao(Integer.parseInt(getCellFormatValue(sheet.getRow(i).getCell(1)).toString()));
//                    item.setShebeimingcheng(getCellFormatValue(sheet.getRow(i).getCell(3)).toString());
//                    item.setShebeipinpai(getCellFormatValue(sheet.getRow(i).getCell(4)).toString());
//                    item.setShebeixinghao(getCellFormatValue(sheet.getRow(i).getCell(5)).toString());
//                    item.setZhongbiaobianma(getCellFormatValue(sheet.getRow(i).getCell(6)).toString());
//                    item.setChanpinmingcheng(getCellFormatValue(sheet.getRow(i).getCell(7)).toString());
//                    item.setGuige(getCellFormatValue(sheet.getRow(i).getCell(8)).toString());
//                    item.setXinghao(getCellFormatValue(sheet.getRow(i).getCell(9)).toString());
//                    item.setZhucezheng(getCellFormatValue(sheet.getRow(i).getCell(10)).toString());
//                    item.setShengchanchangjia(getCellFormatValue(sheet.getRow(i).getCell(11)).toString());
//                    item.setDanwei(getCellFormatValue(sheet.getRow(i).getCell(12)).toString());
//                    item.setDanjia(getCellFormatValue(sheet.getRow(i).getCell(13)).toString());
//                    item.setKeshi(getCellFormatValue(sheet.getRow(i).getCell(14)).toString());
//                    item.setOrdernum(i-3);
//                    item.setIsvote(1);
//                    mmReturnList.add(item);
//                }
//                result =  hc3Mapper.insertBatch(mmReturnList);
//            }
//            if(ppxiangmuleixing.equals("15")) {
//                List<Hc45> mmReturnList = new ArrayList<>();
//                for (int i = 4; i < rows; i++) { //行
//                    Hc45 item = new Hc45();
//                    item.setId(UUID.randomUUID().toString());
//                    item.setXiangmuid(ppxianmguid);
//                    item.setYinjinleixing(getCellFormatValue(sheet.getRow(i).getCell(0)).toString());
//                    item.setZongxuhao(Integer.parseInt(getCellFormatValue(sheet.getRow(i).getCell(1)).toString()));
//                    item.setPinzhongming(getCellFormatValue(sheet.getRow(i).getCell(2)).toString());
//                    item.setPinpai(getCellFormatValue(sheet.getRow(i).getCell(3)).toString());
//                    item.setWuzibianma(getCellFormatValue(sheet.getRow(i).getCell(4)).toString());
//                    item.setPingtaibianma(getCellFormatValue(sheet.getRow(i).getCell(5)).toString());
//                    item.setChanpinmingcheng(getCellFormatValue(sheet.getRow(i).getCell(6)).toString());
//                    item.setGuige(getCellFormatValue(sheet.getRow(i).getCell(7)).toString());
//                    item.setXinghao(getCellFormatValue(sheet.getRow(i).getCell(8)).toString());
//                    item.setZhucezheng(getCellFormatValue(sheet.getRow(i).getCell(9)).toString());
//                    item.setPinpaiming(getCellFormatValue(sheet.getRow(i).getCell(10)).toString());
//                    item.setShengchanchangjia(getCellFormatValue(sheet.getRow(i).getCell(11)).toString());
//                    item.setDanwei(getCellFormatValue(sheet.getRow(i).getCell(12)).toString());
//                    item.setDanjia(getCellFormatValue(sheet.getRow(i).getCell(13)).toString());
//                    item.setYibaobianma(getCellFormatValue(sheet.getRow(i).getCell(14)).toString());
//                    item.setGuochanjinkou(getCellFormatValue(sheet.getRow(i).getCell(15)).toString());
//                    item.setKeshi(getCellFormatValue(sheet.getRow(i).getCell(16)).toString());
//                    item.setTihuanliyou(getCellFormatValue(sheet.getRow(i).getCell(17)).toString());
//
//                    item.setOrdernum(i-3);
//                    item.setIsvote(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(19))).isEmpty()? 0 : 1);
//                    mmReturnList.add(item);
//                }
//                result =  hc45Mapper.insertBatch(mmReturnList);
//            }
//            if(ppxiangmuleixing.equals("16")) {
//                List<Hc45> mmReturnList = new ArrayList<>();
//                for (int i = 4; i < rows; i++) { //行
//                    Hc45 item = new Hc45();
//                    item.setId(UUID.randomUUID().toString());
//                    item.setXiangmuid(ppxianmguid);
//                    item.setYinjinleixing(getCellFormatValue(sheet.getRow(i).getCell(0)).toString());
//                    item.setZongxuhao(Integer.parseInt(getCellFormatValue(sheet.getRow(i).getCell(1)).toString()));
//                    item.setPinzhongming(getCellFormatValue(sheet.getRow(i).getCell(2)).toString());
//                    item.setPinpai(getCellFormatValue(sheet.getRow(i).getCell(3)).toString());
//                    item.setPingtaibianma(getCellFormatValue(sheet.getRow(i).getCell(4)).toString());
//                    item.setChanpinmingcheng(getCellFormatValue(sheet.getRow(i).getCell(5)).toString());
//                    item.setGuige(getCellFormatValue(sheet.getRow(i).getCell(6)).toString());
//                    item.setXinghao(getCellFormatValue(sheet.getRow(i).getCell(7)).toString());
//                    item.setZhucezheng(getCellFormatValue(sheet.getRow(i).getCell(8)).toString());
//                    item.setPinpaiming(getCellFormatValue(sheet.getRow(i).getCell(9)).toString());
//                    item.setShengchanchangjia(getCellFormatValue(sheet.getRow(i).getCell(10)).toString());
//                    item.setDanwei(getCellFormatValue(sheet.getRow(i).getCell(11)).toString());
//                    item.setDanjia(getCellFormatValue(sheet.getRow(i).getCell(12)).toString());
//                    item.setYibaobianma(getCellFormatValue(sheet.getRow(i).getCell(13)).toString());
//                    item.setGuochanjinkou(getCellFormatValue(sheet.getRow(i).getCell(14)).toString());
//                    item.setBeizhu(getCellFormatValue(sheet.getRow(i).getCell(15)).toString());
//                    item.setKeshi(getCellFormatValue(sheet.getRow(i).getCell(16)).toString());
//
//                    item.setOrdernum(i-3);
//                    item.setIsvote(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(19))).isEmpty()? 0 : 1);
//                    mmReturnList.add(item);
//                }
//                result =  hc45Mapper.insertBatch(mmReturnList);
//            }
//            if(ppxiangmuleixing.equals("17")) {
//                List<Hc45> mmReturnList = new ArrayList<>();
//                for (int i = 3; i < rows; i++) { //行
//                    Hc45 item = new Hc45();
//                    item.setId(UUID.randomUUID().toString());
//                    item.setXiangmuid(ppxianmguid);
//                    item.setYinjinleixing(getCellFormatValue(sheet.getRow(i).getCell(0)).toString());
//                    item.setZongxuhao(Integer.parseInt(getCellFormatValue(sheet.getRow(i).getCell(1)).toString()));
//                    item.setPinzhongming(getCellFormatValue(sheet.getRow(i).getCell(2)).toString());
//                    item.setPinpai(getCellFormatValue(sheet.getRow(i).getCell(3)).toString());
//                    item.setPingtaibianma(getCellFormatValue(sheet.getRow(i).getCell(4)).toString());
//                    item.setChanpinmingcheng(getCellFormatValue(sheet.getRow(i).getCell(5)).toString());
//                    item.setGuige(getCellFormatValue(sheet.getRow(i).getCell(6)).toString());
//                    item.setXinghao(getCellFormatValue(sheet.getRow(i).getCell(7)).toString());
//                    item.setZhucezheng(getCellFormatValue(sheet.getRow(i).getCell(8)).toString());
//                    item.setPinpaiming(getCellFormatValue(sheet.getRow(i).getCell(9)).toString());
//                    item.setDanwei(getCellFormatValue(sheet.getRow(i).getCell(10)).toString());
//                    item.setDanjia(getCellFormatValue(sheet.getRow(i).getCell(11)).toString());
//                    item.setYibaobianma(getCellFormatValue(sheet.getRow(i).getCell(12)).toString());
//                    item.setGuochanjinkou(getCellFormatValue(sheet.getRow(i).getCell(13)).toString());
//                    item.setBeizhu(getCellFormatValue(sheet.getRow(i).getCell(14)).toString());
//
//                    item.setOrdernum(i-2);
//                    item.setIsvote(String.valueOf(getCellFormatValue(sheet.getRow(i).getCell(17))).isEmpty()? 0 : 1);
//                    mmReturnList.add(item);
//                }
//                result =  hc45Mapper.insertBatch(mmReturnList);
//            }



            in.close();

            if(result==0){
                return JsonResult.getErrorResult("插入失败！");
            }
            return JsonResult.getSuccessResult("");


        }catch (Exception e) {
            e.printStackTrace();
            logger.error("import_xiangmu -> get_Fujian: "+e.getMessage());
            return JsonResult.getErrorResult("获取项目中的数据失败！");
        }
    }
    private Object getCellFormatValue(Cell cell) {
        Object cellvalue = "";
        if (cell != null) {
            // 判断当前Cell的Type
            switch (cell.getCellType()) {
                case Cell.CELL_TYPE_NUMERIC:// 如果当前Cell的Type为NUMERIC
                case Cell.CELL_TYPE_FORMULA: {
                    // 判断当前的cell是否为Date
                    if (DateUtil.isCellDateFormatted(cell)) {
                        // 如果是Date类型则，转化为Data格式
                        // data格式是带时分秒的：2013-7-10 0:00:00
                        // cellvalue = cell.getDateCellValue().toLocaleString();
                        // data格式是不带带时分秒的：2013-7-10
                        Date date = cell.getDateCellValue();
                        cellvalue = date;
                    } else {// 如果是纯数字
                        cell.setCellType(1);
                        // 取得当前Cell的数值
                        //cellvalue = String.valueOf(cell.getNumericCellValue());
                        cellvalue=cell.getStringCellValue();
                    }
                    break;
                }
                case Cell.CELL_TYPE_STRING:// 如果当前Cell的Type为STRING
                    // 取得当前的Cell字符串
                    cellvalue = cell.getRichStringCellValue().getString();
                    break;
                default:// 默认的Cell值
                    cellvalue = "";
            }
        } else {
            cellvalue = "";
        }
        return cellvalue;
    }

}
